package com.tedu.ourprojct.controller;

import com.tedu.ourprojct.mapper.CheckMapper;
import com.tedu.ourprojct.pojo.dto.CheckUpdateAdminDto;
import com.tedu.ourprojct.pojo.vo.CheckAdminVo;
import com.tedu.ourprojct.pojo.vo.CheckOlderVo;
import com.tedu.ourprojct.pojo.vo.CheckUpdateAdminVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/*入住登记*/
@RestController
@RequestMapping("/check")
public class CheckController {
    @Autowired(required = false)
    CheckMapper mapper;
    @RequestMapping("/select")
    public List<CheckAdminVo> select()
    {
          return mapper.select();
    }

    @RequestMapping("/delete")
    public  void delete(int checkId)
    {
        System.out.println(checkId);
        mapper.delete(checkId);
    }
    @RequestMapping("/selectByid")
    public CheckUpdateAdminVo selectByid(int checkId)
    {
        return mapper.selectByid(checkId);
    }
    @RequestMapping("/selectOlderAll")
    public  List<CheckOlderVo> selectOlderAll()
    {
            return  mapper.selectOlderAll();
    }
    @RequestMapping("/selectOlderByid")
    public CheckUpdateAdminVo selectOlderByid(int id)
    {
        System.out.println(mapper.selectOlderByid(id));
        return mapper.selectOlderByid(id);
    }
 @RequestMapping("/updateByid")
 public  void updateByid(@RequestBody CheckUpdateAdminDto check)
 {
     mapper.update(check);
 }

 //分页
    @RequestMapping("/selectLimit")
    public List<CheckAdminVo> selectLimit(int page,int pagesize)
    {
        page = (page-1)*pagesize;
        return mapper.selectLimit(page,pagesize);
    }
    @RequestMapping("/checkSelectByname")
    public List<CheckAdminVo> checkSelectByname(String name)
    {
        return mapper.checkSelectByname(name);
    }
}
